package com.buyingtickets.controller;

import com.buyingtickets.entity.Route;
import com.buyingtickets.entity.Train;

import com.buyingtickets.service.TrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("route")
public class AdminTrainController {
    @Autowired
    private TrainService trainService;
    @RequestMapping("addroute")
    @ResponseBody
    public String addRoute(@RequestBody Route route,Model model){
        if(trainService.addTrain(route)){
            return "1";
        }else{
            return "0";
        }
    }

}
